import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const ChartSelectorMeta: IPublicTypeComponentMetadata = {
  componentName: 'ChartSelector',
  title: '网约车图表选择器',
  category: '图表',
  group: '出行服务',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'ChartSelector',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'iconBackground',
      propType: 'string',
      description: '图标背景'
    },
    {
      name: 'tabs',
      propType: 'array',
      description: '选项卡列表'
    },
    {
      name: 'activeTabId',
      propType: 'string',
      description: '激活选项卡ID'
    },
    {
      name: 'tabTextColor',
      propType: 'string',
      description: '选项卡文字颜色'
    },
    {
      name: 'showChart',
      propType: 'bool',
      description: '显示图表'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onTabChange',
      propType: 'func',
      description: '选项卡切换事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'iconBackground',
        title: { label: { type: 'i18n', 'en-US': 'iconBackground', 'zh-CN': '图标背景' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/chuxingfuwu/bj14bf9.png' }
      },
      {
        name: 'activeTabId',
        title: { label: { type: 'i18n', 'en-US': 'activeTabId', 'zh-CN': '激活选项卡' } },
        setter: { componentName: 'SelectSetter', isRequired: false, initialValue: 'tab2' }
      },
      {
        name: 'tabTextColor',
        title: { label: { type: 'i18n', 'en-US': 'tabTextColor', 'zh-CN': '选项卡文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.9)' }
      },
      {
        name: 'showChart',
        title: { label: { type: 'i18n', 'en-US': 'showChart', 'zh-CN': '显示图表' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '图表选择器',
    screenshot: '',
    schema: {
      componentName: 'ChartSelector',
      props: {
        width: 410,
        height: 380,
        iconBackground: 'http://localhost:8085/static/images/chuxingfuwu/bj14bf9.png',
        tabs: [
          { id: 'tab1', text: '1号网约车', isActive: false },
          { id: 'tab2', text: '6号网约车', isActive: true },
          { id: 'tab3', text: '网约车人数', isActive: false }
        ],
        activeTabId: 'tab2',
        tabBackgroundColor: 'rgba(5,18,34,0.2)',
        tabBorderColor: '#3A4E74',
        tabTextColor: 'rgba(255,255,255,0.9)',
        tabFontSize: 14,
        tabFontFamily: 'SourceHanSansSC',
        tabFontWeight: 400,
        tabLineHeight: '20px',
        showChart: true,
        theme: 'dark'
      }
    }
  }
];

export default {
  ...ChartSelectorMeta,
  snippets
}; 